package view;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import java.awt.Color;

import javax.swing.JLabel;

import java.awt.Font;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.DropMode;
import javax.swing.SwingConstants;
/**
 * gui for documatation details of sales
 * @author liran
 *
 */
public class FinalAccOrRejGui extends AbstractGUI {
/**
 * documatation details of sales panel
 */
	private JPanel panelOne = null;
	/**
	 * add permission panel
	 */
	private JPanel panelTwo = null;
	/**
	 * comment txt field 
	 */
	private JTextField Commettxt = null;
	/**
	 * how much time u talk with the customer 
	 */
	private JTextField TimeCalltxt = null;
	/**
	 * how much u sale him
	 */
	private JTextField Quantitytxt = null;
/**
 * button for switch to panel 2 
 */
	private JButton btnAddPremission = null;
	
	private JButton btnFinish =null;
	
	private int status = 0;
	/**
	 * Launch the application.
	 */
	private JComboBox  permisscomboBox = null;
	
	private JButton btnAdd = null;
	
	private JButton goback = null;
	

	/**
	 * Create the frame.
	 */
	public FinalAccOrRejGui(int AccOrRej) {
		super(1);
		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		status = AccOrRej;
		getContentPane().setForeground(new Color(178, 34, 34));
		getContentPane().setBackground(new Color(178, 34, 34));
	
		setBounds(500, 200, 450, 300);
		getContentPane().setLayout(null);
		
		panelOne = (JPanel) getContentPane();
		
		JLabel lblNewLabel = new JLabel("Documentation sale");
		lblNewLabel.setFont(new Font("Traditional Arabic", Font.BOLD, 23));
		lblNewLabel.setBounds(10, 11, 294, 54);
		getContentPane().add(lblNewLabel);
		if (AccOrRej == 1){
//=============================================================REJECT================================	
			setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		JLabel lblComment = new JLabel("Comment:");
		lblComment.setFont(new Font("Tahoma", Font.ITALIC, 18));
		lblComment.setBounds(10, 114, 171, 40);
		getContentPane().add(lblComment);
		
		Commettxt = new JTextField();
		Commettxt.setText("write here");
		Commettxt.setForeground(new Color(178, 34, 34));
		Commettxt.setBackground(new Color(255, 255, 255));
		Commettxt.setHorizontalAlignment(SwingConstants.LEFT);
		Commettxt.setBounds(124, 124, 200, 57);
		getContentPane().add(Commettxt);
		Commettxt.setColumns(10);
		}
		
//=============================================================Reject=====================================
		if (AccOrRej == 0){
		JLabel lblNewLabel_1 = new JLabel("Quantity:");
		lblNewLabel_1.setFont(new Font("Sylfaen", Font.BOLD | Font.ITALIC, 20));
		lblNewLabel_1.setBounds(10, 116, 136, 22);
		getContentPane().add(lblNewLabel_1);
		
		Quantitytxt = new JTextField();
		Quantitytxt.setText("0");
		Quantitytxt.setBounds(123, 118, 51, 20);
		getContentPane().add(Quantitytxt);
		Quantitytxt.setColumns(10);
		}
		
		
		
		JLabel lblTimeCall = new JLabel("Time call:");
		lblTimeCall.setFont(new Font("Tahoma", Font.ITALIC, 18));
		lblTimeCall.setBounds(10, 188, 92, 22);
		getContentPane().add(lblTimeCall);
		
		TimeCalltxt = new JTextField();
		TimeCalltxt.setBounds(123, 192, 51, 20);
		getContentPane().add(TimeCalltxt);
		TimeCalltxt.setColumns(10);

		
		
		
		
		
		btnAddPremission = new JButton("Add premission ?");
		btnAddPremission.setFont(new Font("Snap ITC", Font.ITALIC, 15));
		btnAddPremission.setBounds(184, 189, 192, 22);
		getContentPane().add(btnAddPremission);
		
		btnFinish = new JButton("Finish");
		btnFinish.setForeground(new Color(255, 140, 0));
		btnFinish.setFont(new Font("Simplified Arabic Fixed", Font.BOLD | Font.ITALIC, 20));
		btnFinish.setBounds(104, 223, 200, 35);
		getContentPane().add(btnFinish);
		setVisible(true);
	}
	
	
	public void PanelAddPermmision()
	{
		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		setBounds(500, 200, 450, 300);
		panelTwo = new JPanel();
		panelTwo.setBackground(new Color(205, 92, 92));
	//	panelTwo.setBorder(new EmptyBorder(5, 5, 5, 5));

		panelTwo.setLayout(null);
		
		permisscomboBox = new JComboBox();
		permisscomboBox.setBounds(180, 102, 174, 20);
		panelTwo.add(permisscomboBox);
		
		JLabel lblAddPe = new JLabel("Add permissions...");
		lblAddPe.setBackground(new Color(255, 255, 255));
		lblAddPe.setForeground(new Color(255, 255, 255));
		lblAddPe.setFont(new Font("SimSun-ExtB", Font.BOLD | Font.ITALIC, 33));
		lblAddPe.setBounds(10, 11, 330, 62);
		panelTwo.add(lblAddPe);
		
		JLabel lblNewLabel = new JLabel("Choose permissions: ");
		lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 17));
		lblNewLabel.setBounds(10, 92, 174, 34);
		panelTwo.add(lblNewLabel);
		
	    btnAdd = new JButton("ADD");
		btnAdd.setBounds(190, 139, 140, 23);
		panelTwo.add(btnAdd);
		
		 goback = new JButton("Finish");
		 goback.setBounds(0, 228, 434, 34);
	     panelTwo.add(goback);
	     
			setContentPane(panelTwo);
			setVisible(true);
		
	}
	
	
	/**
	 * switch panel
	 */
	public void gobackPlzz(){
		setContentPane(panelOne);
	}
	
	
	public void addADDFromComboAC(ActionListener I)
	{
		btnAdd.addActionListener(I);
	}
	
	
	public void adgoBackAC(ActionListener I)
	{
		goback.addActionListener(I);
	}
	
	/**
	 * set permissions to combobox
	 * @param s
	 */
	public void setItemComboPermm(String s)
	{
		permisscomboBox.addItem(s);
	}
	public JComboBox getpermisscomboBox(){
			return permisscomboBox;
	}
	
	
	
	
	
	
	public int getStatus() {
		return status;
	}
	
	public String getQuantitytxt() {
		return Quantitytxt.getText();
	}
	
	public String getTimeCalltxt() {
		return TimeCalltxt.getText();
	}
	
	public String getCommettxt() {
		return Commettxt.getText();
	}
	
	public void addADDPREbtnAC(ActionListener I)
	{
		btnAddPremission.addActionListener(I);
	}
	
	public void addFinishbtnAC(ActionListener I)
	{
		btnFinish.addActionListener(I);
	}
	
	
}
